
function getCurDate(){   //时间函数
 var ds = new Date();    //   new一个时间
   //获得年份
  var week;     //定义星期几
 switch (ds.getDay()){
 case 1: week="星期一"; break;
 case 2: week="星期二"; break;
 case 3: week="星期三"; break;
 case 4: week="星期四"; break;
 case 5: week="星期五"; break;
 case 6: week="星期六"; break;
 default: week="星期天";
 }
 var year = ds.getYear();
 var years=year<2000?year+1900:year;
 var month = add_zero(ds.getMonth()+1);  //获得月
   var days = add_zero(ds.getDate());  //获得日
 var hours = add_zero(ds.getHours());  //获得时
 var minutes = add_zero(ds.getMinutes()); //获得分
 var seconds=add_zero(ds.getSeconds());//获得秒
 var ndate = years+"年"+month+"月"+days+"日 "+hours+":"+minutes+":"+seconds+" "+week;
 divT.innerHTML= ndate;  //把时间写到divT里面
}

function add_zero(temp)  //
{
 if(temp<10) return "0"+temp;
 else return temp;
}

setInterval("getCurDate()",100);